#ifndef PROCESSOR_CONTEXT_H
#define PROCESSOR_CONTEXT_H

#include <fstream>
#include <iostream>

#include "preq.h"
#include "uarch/mreq.h"
#include "CaffProc/thread.h"
#include "uarch/stat.h"
#include "uarch/module.h"
#include "uarch/settings.h"
#include "uarch/types.h"
#include "uarch/stat_engine.h"

using namespace std;

class Insn;

class Processor_context {
private:
    virtual void dispatch (Mreq *request) =0;
    virtual void dispatch_peek (Mreq *request) =0;

public:
    Processor_context (processor *proc);
    virtual ~Processor_context ();

    processor *my_processor;
    Thread *thread;
    bool suspended;
    bool flush;
    bool peeked;

    int outstanding_reqs;
    LIST<Preq *> outstanding_req_list;

    Insn *peek (void);
    Insn *fetch (void);

    virtual void tick (void) =0;
    virtual void tock (Mreq *request) =0;
    virtual bool context_can_be_released (void) =0;

    void dump_outstanding_requests (void);
};

#endif
